<template>
  <div>
    <el-button type="deleteAll" icon="el-icon-delete" @click="deleteAllVisible = true">删除</el-button>
    <el-dialog
      width="432px"
      title="删除提示"
      :visible.sync="deleteAllVisible"
      
    >
   <p class="first">确定删除此角色？</p>
    <p class="second">具有该角色的管理员将不具有此角色</p>
      <i>
        <img src="@/assets/image/Shape.png" alt />
      </i>
      <span>{{title}}</span>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="sure">确 定</el-button>
        <el-button type="cancel" @click="deleteAllVisible = false">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
    props:["title","multipleSelection","get"],
  data() {
    return {
      deleteAllVisible: false,
      ids:[]
    };
  },
  methods: {
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then(_ => {
          done();
        })
        .catch(_ => {});
    },
    sure(){
      let ids=[];
      this.multipleSelection.forEach(item => {
  ids.push({
    id:item.id
  })
});
this.Api.deleteRole({ids:ids}).then((res)=>{
 
  if(res.code ==='0'){
    this.$message.success('删除成功')
    this.deleteAllVisible=false
    this.get()
  }else{
    return this.$message.error(res.message)
  }
})
    }
  }
};
</script>
<style lang="less" scoped>
/deep/.el-button--deleteAll {
  width: 80px;
  height: 36px;
  background: rgba(255, 255, 255, 1);
  border-radius: 3px;
  border: 1px solid rgba(251, 54, 63, 1);
  padding: 0;
  color: #fb363f;
}
/deep/.el-dialog {
  margin-top: 19% !important;
  box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  > .el-dialog__header {
    padding-left: 70px;
    padding-bottom: 0;
    background: none;
    > span {
      font-size: 16px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: rgba(0, 0, 0, 0.85);
      line-height: 24px;
    }
  }
  > .el-dialog__body {
    padding-left: 70px;
    padding-top: 12px;
    padding-bottom: 24px;
    position: relative;
    > i {
      position: absolute;
      left: 32px;
      top: -22px;
    }
    > span {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(102, 102, 102, 1);
    }
  }
  > .el-dialog__footer {
    .el-button--primary {
      width: 65px;
      height: 32px;
      background: rgba(22, 119, 255, 1);
      padding: 0;
      color: white;
    }
    .el-button--cancel {
      width: 65px;
      height: 32px;
      background: rgba(250, 250, 250, 1);
      border: 1px solid rgba(221, 221, 221, 1);
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(102, 102, 102, 1);
      padding: 0;
      margin-left: 8px;
    }
  }
}
/deep/.el-icon-close:before {
    content: "";
}
.first{
width:330px;
height:22px;
font-size:14px;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(102,102,102,1);
line-height:22px;
}
.second{
  width:330px;
height:18px;
font-size:12px;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(153,153,153,1);
line-height:18px;
}
</style>